// 理解包装对象(类似于Java中的包装类)

const primitive = 2022.12345 ;
console.log( primitive , typeof primitive );

// 创建一个Number实例并在其中包裹指定的原始值
const wrapper = new Number( primitive );
console.log( wrapper , typeof wrapper );

// 获得在Number实例中所包裹的原始值
const value = wrapper.valueOf();
console.log( value , typeof value );

console.log( '- - - - - - - - - - - - - - - - - - - - - - - - -' );

// 获得字符串形式 ( Number.prototype.toString )
console.log( wrapper.toString() );
// 获得字符串形式 ( Number.prototype.toLocaleString )
console.log( wrapper.toLocaleString() );

console.log( '- - - - - - - - - - - - - - - - - - - - - - - - -' );

let x = new Number();
console.log( x , typeof x );

x = new Number( null );
console.log( x , typeof x );

x = new Number( 0 );
console.log( x , typeof x );

x = new Number( '' );
console.log( x , typeof x );

x = new Number( false );
console.log( x , typeof x );

x = new Number( [ ] );
console.log( x , typeof x ); // 0

x = new Number( undefined );
console.log( x , typeof x ); // NaN

x = new Number( { } );
console.log( x , typeof x ); // NaN